This Docker setup creates an isolated and controlled test environment to analyze and reproduce vulnerabilities on an outdated version of WordPress, based on the configuration of the zdnet.be website at the time of the security incident in 2017.
The configured software stack is as follows:
- WordPress 4.7.1 with PHP 5.6 and Apache
- MariaDB 10.1.20 as the database
- Docker installed on your system.
- Docker Compose (usually included with Docker Desktop).
To start all services, run the following command from the project's root folder. Docker will download the necessary images (if you don't already have them) and start the containers in the background.
docker-compose up -dWordPress will be accessible at:
http://localhost:8081
Once the environment is running, follow these steps to configure the site:
- Access WordPress: Open your browser and go to
http://localhost:8081. - Installation Process: You will be presented with the WordPress installation screen. Enter the required credentials.
- Complete Installation: Follow the next steps to give the site a title and create the administrator user.
To replicate the desired look, you need to activate the "NewsUp" theme.
- Activate the theme: Access the WordPress dashboard (
http://localhost:8081/wp-admin), go to "Appearance" -> "Themes", find "NewsUp", and activate it.
For proper environment configuration and to make the content inkection vulnerability reproducible, you need to change the permalink structure:
- Access settings: From the WordPress dashboard (
http://localhost:8081/wp-admin), go to "Settings" -> "Permalinks". - Change the structure: Select "Post name" or any other option that is not "Plain".
- Save changes: Click "Save Changes" to apply the new configuration.
This setup enables more readable URLs and some REST API features required for vulnerability testing.
This environment is now ready for analysis. The scripts to reproduce specific vulnerabilities are located in the project's directories.
In the content-injection directory, there are three main scripts:
script.py: Executes a Content Injection attack, modifying the title and content of the post with ID 1.detect-vuln-exploitation.py: This script analyzes theapache.logfile to detect exploitation attempts of the Content Injection vulnerability, looking for the specific request patterns left by a successful attack.rce-script.py: This script executes the exploit chain described in the documentation to achieve Remote Code Execution. To run it correctly, follow these steps:- Configure the attacker's IP: Open the
content-injection/rce-script.pyfile and change theipvariable to the IP address of your local machine (the one where you will runnetcat). - Start the listener: Open a terminal and listen with
netcaton the port specified in the script (e.g.,nc -lvnp 4444). - Run the script: Launch the Python script (
python3 content-injection/rce-script.py). This will inject the dormant payload into the post. - Trigger the payload: Visit the modified post's page (the script will provide the link) to trigger the reverse shell. Check your
netcatterminal for the incoming connection.
- Configure the attacker's IP: Open the
The scripts related to this vulnerability are located in the reflected-xss directory. Run the scripts to reproduce CVE-2017-9061.
- Stop the environment: To stop the containers without deleting the database data.
docker-compose down
- Reset the environment: To stop the containers AND DELETE the database (useful for starting the installation from scratch).
docker-compose down -v